package com.gxar.quick.ar.server.base.common.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * @author linsy
 * @version 1.0
 * @created 2023/11/11 09:55
 */
@Data
@Component
@ConfigurationProperties(prefix = "xxl.job")
@RefreshScope
public class XxlJobProperties {

    private String accessToken;
    private final AdminProperties adminProperties;
    private final ExecutorProperties executorProperties;


    @Data
    @Configuration
    @ConfigurationProperties(prefix = "xxl.job.admin")
    @RefreshScope
    public static class AdminProperties {

        private String addresses;

    }

    @Data
    @Configuration
    @ConfigurationProperties(prefix = "xxl.job.executor")
    @RefreshScope
    public static class ExecutorProperties {

        private String appName;
        private String ip;
        private String startWithIp;
        private Integer port;
        private String logPath;
        private Integer logRetentionDays;

    }
}
